<div class="page-header">
    <div class="icon">
        <span class="ico-layout-7"></span>
    </div>
    <h1>Listado de Facturas <small>Facturas generadas </small></h1>
</div>

<div class="block">
<div class="data-fluid">

                                <div class="row-form success">
                                <?php echo $this->Form->create('Facturacione');?>
                                <div class="span10">
                                
                                    <div class="span2">
                                        <?php echo $this->Form->text('fecha_ini',array('class' => 'mask_date','value' => ''));?>
                                        
                                        <span class="bottom">Fecha Inicial</span>
                                    </div>
                                    <div class="span2">
                                        <?php echo $this->Form->text('fecha_fin',array('class' => 'mask_date','value' => ''));?>
                                        <span class="bottom">Fecha Final</span>
                                    </div>
                                    <div class="span2">
                                        <?php echo $this->Form->text('factura');?>
                                        <span class="bottom">Nro de Factura</span>
                                    </div>
                                    <div class="span2">
                                        <?php echo $this->Form->submit('Buscar',array('class' => 'btn btn-info'));?>
                                        <?php echo $this->Form->end();?>
                                    </div>
                                </div>
                                    
                                </div>
</div>

    <div class="head dblue">
        <div class="icon"><span class="ico-layout-9"></span></div>
        <h2>Transacciones</h2>
        <ul class="buttons">
            <li><a href="#" onClick="source('table_sort_pagination');
                    return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
        </ul>                                                        
    </div>                
    <div class="data-fluid">
        <table class="table fpTable lcnp" cellpadding="0" cellspacing="0" width="100%">
            <thead>
                <tr>
                    <th width="5%">Fecha</th>
                    <th width="7%">Nit Comprador</th>
                    <th width="10%">Comprador</th>
                    <th width="5%">No. Factura</th>
                    <th width="6%">Cod. Control</th>
                    <th width="10%">No. Autorizacion</th>
                    <th width="6%">Importe Neto</th>
                    <th width="6%">Debito Fiscal</th>  
                    <th width="7%">Acciones</th>  
                </tr>
            </thead>
            <tbody>
                <?php foreach ($transacciones as $t): ?>
                <tr>
                        <td><?php echo $t['Facturacione']['fecha_transaccion']; ?></td>
                        <td><?php echo $t['Facturacione']['nit_ci_cliente']; ?></td>
                        <td><?php echo $t['Facturacione']['nombre_cliente']; ?></td>
                        <?php $color = ($t['Facturacione']['estado']==0)?'style="background-color: #d59392"':''; ?>
                        <td <?php echo $color; ?>><?php echo $t['Facturacione']['numero_factura']; ?></td>
                        <td><?php echo $t['Facturacione']['codigo_control']; ?></td>
                        <td><?php echo $t['Facturacione']['numero_autorizacion']; ?></td>
                        <td>
                            <?php
                            echo $montoNeto = $t['Facturacione']['monto_transaccion'];
                            ?>
                        </td>
                        <td>
                            <?php
                            echo $debitoFiscal = $montoNeto * 0.13;
                            ?>
                        </td>
                        <td>
                            <?php $idFactura = $t['Facturacione']['id']; ?>
                            <a onclick="return confirm('Desea anular la factura <?php echo $t['Facturacione']['numero_factura']; ?>?');" href="<?php echo $this->Html->url(array('action'=>'anulacion', $idFactura)); ?>" class="button red">
                                <div class="icon"><span class="ico-remove"></span></div>
                            </a> 
                        </td>
                    </tr>                       
                <?php endforeach; ?>
            </tbody>
        </table>                    
    </div> 
</div>    